﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Graphics.PackedVector;

using WindowsGameXmlDataTypes;



namespace WindowsGame
{
    public class TerrainResources
    {
        public Texture2D heightMapAtlas;
        public Texture2D paintedMaterialatlas;
        public Texture2D material1;
        public Texture2D material2;
        public Texture2D material3;
        public Texture2D material4;
        public Texture2D material5;
        public Texture2D materialSlope;

        public Effect terrainPatchEffect;

		public float heightScale;
		public float slopeFactor;
		public float cellSpacing;
		public float materialScale;
		public int atlasDim;
		public int atlasTileDim;
		public int atlasNumActiveTile;
		public int atlasNumTilePerCols;
		public int atlasPadding;



        public TerrainResources(ContentManager content)
        {
			TerrainParameters parameters = content.Load<TerrainParameters>("Xml\\Terrain");

			material1 = content.Load<Texture2D>(parameters.material1);
			material2 = content.Load<Texture2D>(parameters.material2);
			material3 = content.Load<Texture2D>(parameters.material3);
			material4 = content.Load<Texture2D>(parameters.material3);
			material5 = content.Load<Texture2D>(parameters.material4);
			materialSlope = content.Load<Texture2D>(parameters.slopeMaterial);
			paintedMaterialatlas = content.Load<Texture2D>(parameters.blendingAtlas);
			heightMapAtlas = content.Load<Texture2D>(parameters.heightmapAtlas);

			terrainPatchEffect = content.Load<Effect>(parameters.effect);

			heightScale = parameters.heightScale;
			slopeFactor = parameters.slopeFactor;
			cellSpacing = parameters.cellSpacing;
			materialScale = parameters.materialScale;
			atlasDim = parameters.atlasDim;
			atlasTileDim = parameters.atlasTileDim;
			atlasNumActiveTile = parameters.atlasNumActiveTile;
			atlasNumTilePerCols = parameters.atlasNumTilePerCols;
			atlasPadding = parameters.atlasPadding;
        }
    }
}